package com.rongchuang.controller;

import com.rongchuang.dto.ActivityAlbumDTO;
import com.rongchuang.service.ActivityAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("activity-album")
public class ActivityAlbumController {

    @Autowired
    private ActivityAlbumService activityAlbumService;

    /**
     * 分页查询活动相册
     */
    @GetMapping("page")
    public Page<ActivityAlbumDTO> pageSearch(@RequestParam(defaultValue = "0") int pageNum,
                                             @RequestParam(defaultValue = "10") int pageSize) {
        return activityAlbumService.pageSearch(pageNum, pageSize);
    }

    /**
     * 保存活动相册
     * @param activityAlbumDTO 参数
     */
    @PostMapping("modify")
    public void modify(@RequestBody ActivityAlbumDTO activityAlbumDTO) {
        activityAlbumService.modifyActivityAlbum(activityAlbumDTO);
    }

    /**
     * 获取活动相册
     * @param id 商会id
     * @return 商会信息
     */
    @GetMapping("detail/{id}")
    public ActivityAlbumDTO detail(@PathVariable Long id) {
        return activityAlbumService.getDetail(id);
    }
}
